﻿<phone:PhoneApplicationPage xmlns:my="clr-namespace:WP7.LockerPlayer.Views"  
    x:Class="WP7.LockerPlayer.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
   xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:local="clr-namespace:WP7.LockerPlayer"
    xmlns:data="clr-namespace:WP7.LockerPlayer.ViewModels"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800" 
    d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
    
    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="artistGroupHeader">
            <Border Background="{StaticResource PhoneAccentBrush}" Padding="{StaticResource PhoneTouchTargetOverhang}">
                <TextBlock Text="{Binding Key}" Style="{StaticResource PhoneTextLargeStyle}"/>
            </Border>
        </DataTemplate>

        <!-- The template for groups when they are items in the "jump list". Not setting -->
        <!-- the GroupItemTemplate property will disable "jump list" functionality. -->
        <DataTemplate x:Key="groupItemHeader">
            <Border Background="{StaticResource PhoneAccentBrush}" Margin="{StaticResource PhoneTouchTargetOverhang}" Padding="{StaticResource PhoneTouchTargetOverhang}">
                <TextBlock Text="{Binding Key}" Style="{StaticResource PhoneTextLargeStyle}"/>
            </Border>
        </DataTemplate>
      
    </phone:PhoneApplicationPage.Resources>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="*">
                
            </RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
        </Grid.RowDefinitions>
        <!--Pivot Control-->
        <controls:Pivot  Grid.Row="0">
            <controls:Pivot.TitleTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WP7.LockerPlayer;component/Images/logo.png" VerticalAlignment="Top"/>
                        <TextBlock Text="{Binding Path=LocalizedResources.AppTitle, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center" FontSize="33"/>
                    </StackPanel>
                </DataTemplate>
            </controls:Pivot.TitleTemplate>
            <!--Pivot item one-->
            <controls:PivotItem Header="{Binding Path=LocalizedResources.ArtistsPivotHeader, Source={StaticResource LocalizedStrings}}">
                <!--Double line list with text wrapping-->



                <toolkit:LongListSelector x:Name="artistListBox" Background="Transparent" 
                     ItemsSource="{Binding}"
                    
                      SelectionChanged="artistListBox_SelectionChanged">
                    <toolkit:LongListSelector.GroupItemsPanel>
                        <ItemsPanelTemplate>
                            <toolkit:WrapPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </toolkit:LongListSelector.GroupItemsPanel>
                    <toolkit:LongListSelector.GroupItemTemplate>
                        <DataTemplate>
                            <Border Background="{StaticResource PhoneAccentBrush}" Width="99" Height="99" Margin="6" IsHitTestVisible="{Binding HasItems}">
                                <TextBlock Text="{Binding Key}" 
                                       FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                       FontSize="36"
                                       Margin="{StaticResource PhoneTouchTargetOverhang}"
                                       Foreground="{StaticResource PhoneForegroundBrush}"                                        
                                       VerticalAlignment="Bottom"/>
                            </Border>
                        </DataTemplate>
                    </toolkit:LongListSelector.GroupItemTemplate>

                    <toolkit:LongListSelector.GroupHeaderTemplate>
                        <DataTemplate>
                            <Border Background="Transparent">
                                <Border Background="{StaticResource PhoneAccentBrush}" Width="75" Height="75" HorizontalAlignment="Left">
                                    <TextBlock Text="{Binding Key}" 
                                           Foreground="{StaticResource PhoneForegroundBrush}" 
                                           Style="{StaticResource PhoneTextExtraLargeStyle}"
                                           VerticalAlignment="Bottom"/>
                                </Border>
                            </Border>
                        </DataTemplate>
                    </toolkit:LongListSelector.GroupHeaderTemplate>
                    <toolkit:LongListSelector.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Margin="0,0,0,17" Width="430">
                                <TextBlock Text="{Binding ArtistName}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                                <!--<TextBlock Text="{Binding AlbumCountMessage}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>-->

                            </StackPanel>
                        </DataTemplate>
                    </toolkit:LongListSelector.ItemTemplate>

                </toolkit:LongListSelector>


            </controls:PivotItem>
 
            <!--Pivot item two-->
            <controls:PivotItem Header="{Binding Path=LocalizedResources.AlbumsPivotHeader, Source={StaticResource LocalizedStrings}}"> 
                <!--Triple line list no text wrapping-->
                    <!--<ListBox x:Name="albumsList" Margin="0,0,-12,0"
                             Style="{StaticResource BlackListStyle}"
                              ItemsPanel="{StaticResource BlackListItemsPanelTemplate}"
                             ItemContainerStyle="{StaticResource BlackListItemStyle}"
                             ItemsSource="{Binding Albums}"   SelectionChanged="albumsList_SelectionChanged">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                            <StackPanel Margin="0,0,0,17" Width="430">
                                    <TextBlock Text="{Binding AlbumTitle}" TextWrapping="NoWrap" Margin="12,0,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>-->
                <toolkit:LongListSelector x:Name="albumsList" Background="Transparent" 
                     ItemsSource="{Binding}"
                    
                      SelectionChanged="albumsList_SelectionChanged">
                <toolkit:LongListSelector.GroupItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </toolkit:LongListSelector.GroupItemsPanel>
                <toolkit:LongListSelector.GroupItemTemplate>
                        <DataTemplate>
                            <Border Background="{StaticResource PhoneAccentBrush}" Width="99" Height="99" Margin="6" IsHitTestVisible="{Binding HasItems}">
                                <TextBlock Text="{Binding Key}" 
                                       FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                       FontSize="36"
                                       Margin="{StaticResource PhoneTouchTargetOverhang}"
                                       Foreground="{StaticResource PhoneForegroundBrush}"                                        
                                       VerticalAlignment="Bottom"/>
                            </Border>
                        </DataTemplate>
                    </toolkit:LongListSelector.GroupItemTemplate>

                <toolkit:LongListSelector.GroupHeaderTemplate>
                    <DataTemplate>
                        <Border Background="Transparent">
                            <Border Background="{StaticResource PhoneAccentBrush}" Width="75" Height="75" HorizontalAlignment="Left">
                                <TextBlock Text="{Binding Key}" 
                                           Foreground="{StaticResource PhoneForegroundBrush}" 
                                           Style="{StaticResource PhoneTextExtraLargeStyle}"
                                           VerticalAlignment="Bottom"/>
                            </Border>
                        </Border>
                    </DataTemplate>
                </toolkit:LongListSelector.GroupHeaderTemplate>
                <toolkit:LongListSelector.ItemTemplate>
                    <DataTemplate>
                            <StackPanel Margin="0,0,0,17" Width="430">
                                <TextBlock Text="{Binding AlbumTitle}" TextWrapping="NoWrap" Margin="12,0,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                            </StackPanel>
                     
                        </DataTemplate>
                </toolkit:LongListSelector.ItemTemplate>

                </toolkit:LongListSelector>

            </controls:PivotItem>
            <controls:PivotItem Header="{Binding Path=LocalizedResources.PlaylistPivotHeader, Source={StaticResource LocalizedStrings}}">
                <!--Triple line list no text wrapping-->
                <ListBox x:Name="playlistsListBox" Margin="0,0,-12,0" 
                         Style="{StaticResource BlackListStyle}"
                              ItemsPanel="{StaticResource BlackListItemsPanelTemplate}"
                             ItemContainerStyle="{StaticResource BlackListItemStyle}"
                         ItemsSource="{Binding Playlists}"
                 
                         SelectionChanged="playlistsListBox_SelectionChanged">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Margin="0,0,0,17" Width="430">
                                <TextBlock Text="{Binding PlaylistTitle}" TextWrapping="NoWrap" Margin="12,0,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                                <!--<TextBlock Text="{Binding PlaylistSizeMessage}" TextWrapping="NoWrap" Margin="12,-6,0,0" Style="{StaticResource PhoneTextSubtleStyle}"/>-->
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>
            <controls:PivotItem Header="{Binding Path=LocalizedResources.LogPivotHeader, Source={StaticResource LocalizedStrings}}"   >
                <StackPanel>
             
                 
                    <Button Content="Update" Click="Button_Click"   />
                    <ScrollViewer>
                        <TextBlock Name="logMessage" TextWrapping="Wrap"/>
                    </ScrollViewer>
                   
                </StackPanel>
            </controls:PivotItem>
            <controls:PivotItem Header="{Binding Path=LocalizedResources.SettingsPivotHeader, Source={StaticResource LocalizedStrings}}"  >
             <my:SettingsView  OnCacheClear="SettingsView_OnCacheClear"/>
            </controls:PivotItem>
        </controls:Pivot>
       
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="250"></ColumnDefinition>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Name="status" Grid.ColumnSpan="2"/>

            <ProgressBar Name="progressInd" Style="{StaticResource PerformanceProgressBar}" Grid.Column="1" ></ProgressBar>
        </Grid>
    </Grid>
 
    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>